//
//  ViewController.m
//  Tabbar
//
//  Created by 吴志勇 on 2020/4/9.
//  Copyright © 2020 wzy. All rights reserved.
//

#import "ViewController.h"
#import "TestViewController.h"
#import "YellowViewController.h"

@interface ViewController ()

@end

@implementation ViewController

- (void)viewDidLoad {
    [super viewDidLoad];
    // Do any additional setup after loading the view.
    self.view.backgroundColor = [UIColor blueColor];
    self.navigationController.navigationBar.backItem.hidesBackButton = YES;
       UIButton *btn = [UIButton buttonWithType:UIButtonTypeCustom];
        btn.frame = CGRectMake(40, 200, 200, 200);
    [btn setBackgroundImage:[UIImage imageNamed:@"nav_back"] forState:UIControlStateNormal];
//    [btn setImage:[UIImage imageNamed:@"nav_back"] forState:UIControlStateNormal];
        [btn addTarget:self action:@selector(click) forControlEvents:UIControlEventTouchUpInside];
        [self.view addSubview:btn];
    }

    //
- (void)click{
    UITabBarController *tabbarVC = self.tabBarController;
    tabbarVC.selectedViewController = tabbarVC.viewControllers[0];
    
    [tabbarVC.selectedViewController pushViewController:[[TestViewController alloc] init] animated:YES];
//
//    [self.navigationController pushViewController:[[TestViewController alloc]init] animated:YES];
}

@end
